_base_ = '../../configs/cornernet/cornernet_hourglass104_mstest_10x5_210e_coco.py'
dataset_type = 'CocoDataset'
classes = ('artemisia', 'chenopodiaceae', 'moraceae', 'gramineae', 'pinaceae')

img_norm_cfg = dict(
    mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True)
train_pipeline = [
    dict(type='LoadImageFromFile', to_float32=True),
    dict(type='LoadAnnotations', with_bbox=True),
    dict(
        type='PhotoMetricDistortion',
        brightness_delta=32,
        contrast_range=(0.5, 1.5),
        saturation_range=(0.5, 1.5),
        hue_delta=18),
    dict(
        type='RandomCenterCropPad',
        crop_size=(511, 511),
        ratios=(0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3),
        test_mode=False,
        test_pad_mode=None,
        **img_norm_cfg),
    dict(type='Resize', img_scale=(511, 511), keep_ratio=False),
    dict(type='RandomFlip', flip_ratio=0.5),
    dict(type='Normalize', **img_norm_cfg),
    dict(type='DefaultFormatBundle'),
    dict(type='Collect', keys=['img', 'gt_bboxes', 'gt_labels']),
]
test_pipeline = [
    dict(type='LoadImageFromFile', to_float32=True),
    dict(
        type='MultiScaleFlipAug',
        scale_factor=1.0,
        flip=True,
        transforms=[
            dict(type='Resize'),
            dict(
                type='RandomCenterCropPad',
                crop_size=None,
                ratios=None,
                border=None,
                test_mode=True,
                test_pad_mode=['logical_or', 127],
                **img_norm_cfg),
            dict(type='RandomFlip'),
            dict(type='Normalize', **img_norm_cfg),
            dict(type='ImageToTensor', keys=['img']),
            dict(
                type='Collect',
                keys=['img'],
                meta_keys=('filename', 'ori_shape', 'img_shape', 'pad_shape',
                           'scale_factor', 'flip', 'img_norm_cfg', 'border')),
        ])
]
data = dict(
    samples_per_gpu=1,
    workers_per_gpu=3,
    train=dict(type=dataset_type,
               # explicitly add your class names to the field `classes`
               classes=classes,
               pipeline=train_pipeline,
               ann_file='/home/ubuntu/code/mmdetection-master/pollen_data/paper_train.json',
               img_prefix='/home/ubuntu/code/detectron2-latest/datasets/pollen_data/0318/imgs'),
    val=dict(
        type=dataset_type,
        # explicitly add your class names to the field `classes`
        pipeline=test_pipeline,
        classes=classes,
        ann_file='/home/ubuntu/code/mmdetection-master/pollen_data/paper_val.json',
        img_prefix='/home/ubuntu/code/detectron2-latest/datasets/pollen_data/0318/imgs'
    ),
    test=dict(type=dataset_type,
              # explicitly add your class names to the field `classes`
              pipeline=test_pipeline,
              classes=classes,
              ann_file='/home/ubuntu/code/mmdetection-master/pollen_data/paper_test.json',
              img_prefix='/home/ubuntu/code/detectron2-latest/datasets/pollen_data/0318/imgs'
              )
)
model = dict(
    bbox_head=dict(
        type='CornerHead',
        num_classes=5,
    )
)
lr_config = dict(
    policy='step',
    warmup='linear',
    warmup_iters=500,
    warmup_ratio=1.0 / 3,
    step=[16, 22])

runner = dict(type='EpochBasedRunner', max_epochs=24)
load_from = '/home/ubuntu/code/mmdetection-master/checkpoints/cornernet_hourglass104_mstest_10x5_210e_coco_20200824_185720-5fefbf1c.pth'
work_dir = '/home/ubuntu/code/mmdetection-master/result/corner-net'
